package com.googlecode.tda367.denty.core.level;

import org.jbox2d.collision.shapes.PolygonShape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.Body;
import org.jbox2d.dynamics.BodyDef;
import org.jbox2d.dynamics.BodyType;

import com.googlecode.tda367.denty.core.camera.Camera;
import com.googlecode.tda367.denty.core.camera.MovingCamera;

// This class is necessary for testing since the other levels require that the Slick framework
// because of a depenency on TileMap. This class will make it possible to test AbstractLevel where
// all the level logig resides.
public class TestLevel extends AbstractLevel {

	private Camera camera;

	public TestLevel() {
		super();
		this.camera = new MovingCamera(this.getWidth(), this.getHeight(), this.getWidth(), this.getHeight());
		this.createWorld();
	}

	private void createWorld() {
		BodyDef staticBodyDef = new BodyDef();
		staticBodyDef.fixedRotation = true;
		staticBodyDef.position = new Vec2(50, 12.5f);
		staticBodyDef.type = BodyType.STATIC;
		Body tileBody = this.getWorld().createBody(staticBodyDef);
		PolygonShape ps = new PolygonShape();
		ps.setAsBox(50, 0.5f);
		tileBody.createFixture(ps, 0);
	}

	@Override
	public String getTiledMapPath() {
		// Cannot use TileMaps without running OpenGL-engine.
		return null;
	}

	@Override
	public Camera getCamera() {
		return this.camera;
	}

	@Override
	public int getHeight() {
		return 100;
	}

	@Override
	public int getWidth() {
		return 100;
	}

	@Override
	public int getDentyStartX() {
		return 10;
	}

	@Override
	public int getDentyStartY() {
		return 10;
	}

	@Override
	public int getGoalX() {
		return 20;
	}

	@Override
	public int getGoalY() {
		return 10;
	}

	@Override
	public int getMaxAvailableBlocks() {
		return 10;
	}

	@Override
	public int getBlocksAvailableFromStart() {
		return 5;
	}
}